﻿using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;

namespace WenABP.Customer.Domain.Data
{
    public class CustomerStoreMigratorService:ITransientDependency
    {
        public ILogger<CustomerStoreMigratorService> Logger { get; set; }

        private readonly ICustomerStoreSchemaMigrator _dbSchemaMigrator;

        public CustomerStoreMigratorService(ICustomerStoreSchemaMigrator dbSchemaMigrator)
        {
            _dbSchemaMigrator = dbSchemaMigrator;
            Logger = NullLogger<CustomerStoreMigratorService>.Instance;
        }

        public async Task MigrateAsync()
        {
            Logger.LogInformation("开始迁移数据库");
            await _dbSchemaMigrator.MigrateAsync();
            Logger.LogInformation("迁移数据库完成");
        }

    }
}
